import ajax from "./ajax";
const BAST_URL = '/api'
// 1、根据经纬度获取位置详情
export const reqAddress = (geohash) => ajax(BAST_URL+`/position/${geohash}`)

// 2、获取食品分类列表 http://localhost:3000/index_category
export const reqFoodCategorys = () => ajax(BAST_URL+'/index_category')

// 3、根据经纬度获取商铺列表 http://localhost:3000/shops?latitude=40.10038&longitude=116.36867
export const reqShops = (longitude,latitude) => ajax(BAST_URL+`/shops`,{longitude,latitude})
// 4、根据经纬度和关键字搜索商铺列表
export const reqSearchShop = (geohash,keyword) => ajax(BAST_URL+`/search_shops`,{geohash,keyword})

// 6、用户名密码登陆
export const reqPwdLogin = ({name,pwd,captcha}) => ajax(BAST_URL+`/login_pwd`,{name,pwd,captcha},'POST')

// 7、发送短信验证码
export const reqSendCode = (phone) => ajax(BAST_URL+`/sendcode`,{phone})

// 8、手机号验证码登陆
export const reqSmsLogin = (phone,code) => ajax(BAST_URL+`/login_sms`,{phone,code},'POST')

// 9、根据会话获取用户信息
export const reqUserInfo = () => ajax(BAST_URL+`/userinfo`)

// 10、用户登出
export const reqLogout = () => ajax(BAST_URL+`/logout`)


/**
 * 获取商家商品数组
 */
export const reqShopGoods = () => ajax('/goods')

/**
 * 获取商家评价数组
 */
export const reqShopRatings = () => ajax('/ratings')

/**
* 获取商家信息
*/
export const reqShopInfo = () => ajax('/info')
